package com.aounhui.productor.common;

/**
 * @author aounhui
 * @version 1.0
 * @date 2021/7/1 10:20
 * @description
 */
public class GetThread {
    /**
     * 根据线程名称获取线程
     * @param threadName
     * @return
     */
    public static Thread getThreadByName(String threadName) {
        for (Thread t : Thread.getAllStackTraces().keySet()) {
            if (t.getName().equals(threadName)) {
                return t;
            }
        }
        return null;
    }
}
